package cn.xiqi.cms.action;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class BaseAction extends ActionSupport {

	private static final long serialVersionUID = 6103455824345739345L;

	protected boolean isTimeout(){
		if(ActionContext.getContext().getSession().get("username")==null){
			return true;
		}else {
			return false;
		}
	}
	
	protected boolean isExistSession(String key){
		if(ActionContext.getContext().getSession().get(key)!=null){
			return true; 
		}else {
			return false;
		}
	}
	
	protected void setSession (String key,Object obj) {
		ActionContext.getContext().getSession().put(key, obj);
	}
	
	protected Object getSession(String key){
		return ActionContext.getContext().getSession().get(key);
	}
	
	protected void saveActionMessage(String key){
		super.addActionMessage(super.getText(key));
	}
}
